/**
 * 
 */
package com.android.fxcontacts;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.provider.ContactsContract.StatusUpdates;

/**
 * Define the contact present show policy in Contacts
 * 
 */
public class ContactPresenceIconUtil
{
	/**
	 * Get the presence icon resource according the status.
	 * 
	 * @return null means don't show the status icon.
	 */
	public static Drawable getPresenceIcon(Context context, int status)
	{
		// We don't show the offline status in Contacts
		switch (status)
		{
		case StatusUpdates.AVAILABLE:
		case StatusUpdates.IDLE:
		case StatusUpdates.AWAY:
		case StatusUpdates.DO_NOT_DISTURB:
		case StatusUpdates.INVISIBLE:
			return context.getResources().getDrawable(
					StatusUpdates.getPresenceIconResourceId(status));
		case StatusUpdates.OFFLINE:
			// The undefined status is treated as OFFLINE in
			// getPresenceIconResourceId();
		default:
			return null;
		}
	}
}
